package com.sky.es.api;

import com.sky.es.entity.ProductDoc;
import com.sky.es.service.ProductSuggQueryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yangsk
 */
@RestController
@RequestMapping("/suggs")
public class SuggQueryAPI {
    @Autowired
    private ProductSuggQueryService suggQueryService;

    @ApiOperation(value = "根据商品名称或描述进行推荐搜索", notes = "根据商品名称或描述进行推荐搜索")
    @GetMapping("/sugg")
    public List<ProductDoc> queryBySugg(@RequestParam("sugg")String sugg){
        return suggQueryService.queryBySugg(sugg);
    }
}
